<template>
  <div>
    <a :href="wxOauthUrl" ref="aTagOfWx"> </a>
  </div>
</template>

<script>
import pConfig from "./config";
export default {
  data() {
    return {
      key: "",
      // wxOauthUrl: `https://binlife.net/binpay/wxpay/authorize.jsp?appid=bp201908010000001&sign=aaaaa&redirect_uri=${encodeURI(pConfig.hostname + '/badPay/contractQuery')}&response_type=code&scope=snsapi_base&state=123#wechat_redirect`
      // wxOauthUrl: `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${pConfig.appid}&redirect_uri=${encodeURI(pConfig.hostname + "/wx/callback")}&response_type=code&scope=snsapi_base&state=123#wechat_redirect`,
    };
  },
  computed: {
    wxOauthUrl: function () {
      return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${
        pConfig.appid
      }&redirect_uri=${encodeURI(
        pConfig.hostname + `/wx/callback?key=${this.key}`
      )}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`;
    },
  },
  async mounted() {
    this.key = this.$route.query.key || "4120";
    await this.$nextTick(() => {});
    this.$refs.aTagOfWx.click();
  },
};
</script>

<style lang="scss" scoped></style>
